Current Location: Home> Function Categories> floor

floor

Leave the method of sorting
Name:floor
Category:math
Programming Language:php
One-line Description:Round down to the closest integer.

Definition and usage

floor() function rounds down to the closest integer.

Example

In this example, we will apply floor() function to different numbers:

 <?php
echo ( floor ( 0.60 ) ) ;
echo ( floor ( 0.40 ) ) ;
echo ( floor ( 5 ) ) ;
echo ( floor ( 5.1 ) ) ;
echo ( floor ( - 5.1 ) ) ;
echo ( floor ( - 5.9 ) )
?>

Try it yourself

grammar

 floor ( x )
parameter describe
x Required. A number.

illustrate

Returns the next integer no greater than x and rounds the decimal part of x . The type returned by floor() is still float, because the range of float values ​​is usually larger than integer.

Similar Functions
  • Square root sqrt

    sqrt

    Squareroot
  • Exponential expressions pow

    pow

    Exponentialexpressio
  • Calculate the oblique length of a straight triangle hypot

    hypot

    Calculatetheobliquel
  • Perform floating point division under IEEE 754 semantics fdiv

    fdiv

    Performfloatingpoint
  • Convert hexadecimal to decimal hexdec

    hexdec

    Converthexadecimalto
  • Generate a random integer rand

    rand

    Generatearandominteg
  • Tilt tan

    tan

    Tilt
  • Antihyperbolic cosine acosh

    acosh

    Antihyperboliccosine
Popular Articles